Skip to content

Fix duplicate SummarizationMiddleware error#30

Merged
quan0715 merged 1 commit intomainfrom
frontend/reforge-visual-redesign
Feb 7, 2026
Merged

Fix duplicate SummarizationMiddleware error#30
quan0715 merged 1 commit intomainfrom
frontend/reforge-visual-redesign

Conversation

@quan0715
Copy link
Copy Markdown
Owner

@quan0715 quan0715 commented Feb 7, 2026

Summary

  • Revert manual SummarizationMiddleware addition that caused Please remove duplicate middleware instances error
  • create_deep_agent already adds it automatically when checkpointer is enabled

Test plan

  • Chat execution no longer throws duplicate middleware error

🤖 Generated with Claude Code

create_deep_agent already adds SummarizationMiddleware when
checkpointer is enabled. Remove manual addition to avoid duplicate.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings February 7, 2026 01:08
@quan0715 quan0715 merged commit c3af069 into main Feb 7, 2026
3 checks passed
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes the manual SummarizationMiddleware configuration in RefactorAgent to avoid a runtime error caused by duplicate middleware instances, relying instead on create_deep_agent’s automatic middleware handling when a checkpointer is enabled.

Changes:

  • Removed explicit SummarizationMiddleware instantiation from agent initialization.
  • Updated agent initialization to pass no custom middleware.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread agent/deep_agent.py
Comment on lines +151 to 153
# middleware 由 create_deep_agent 在啟用 checkpointer 時自動管理
middleware = []

Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With middleware now always set to an empty list, the SummarizationMiddleware import becomes unused, and the later middleware=middleware if middleware else None will always pass None. Please remove the unused import and consider dropping the middleware local/argument entirely (or pass middleware=None directly) for clarity.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants